# encoding: utf-8
# 项目名称： 常用设计模式
# @File  : 011-外观模式.py
# @Author: sun hao
# @Desc : 
# @Date  :   19:57 2024/11/04
class CPU:
    def run(self):
        print("cpu启动")

    def stop(self):
        print("cpu停止")


class DISK:
    def run(self):
        print("disk启动")

    def stop(self):
        print("disk停止")


class Memory:
    def run(self):
        print("Memory启动")

    def stop(self):
        print("Memory停止")


class Computer:
    def __init__(self):
        self.cpu = CPU()
        self.disk = DISK()
        self.memory = Memory()

    def run(self):
        print('开机')
        self.cpu.run()
        self.disk.run()
        self.memory.run()

    def stop(self):
        print('关机')
        self.cpu.stop()
        self.disk.stop()
        self.memory.stop()




# 客户端代码
HuaWeiPc = Computer()
HuaWeiPc.run() # 开机

HuaWeiPc.stop() # 关机